<template>
  <div>
    <div>
      <span>基本信息</span>
      <FormPanel ref="formPanel_ownerRemark" :list="formList_ownerRemark" :cols="3" :labelWidth="100" :formType="type" :isSubmitBtn="false" @formChange="formChangeHandle_ownerRemark" />
    </div>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
import { getOwnerInfoByOwnerNoAndDealerCode } from '@/api/customerRepair/customerInfo/ownerVehicleManagement';

export default {
  name: 'addOwner_ownerRemark',
  mixins: [dictionary],
  props: {
    type: {
      type: String,
      default: 'add'
    },
    resData: {
      type: Object,
      default: {}
    }
  },
  data() {
    this.saveData_ownerRemark = {};
    return {
      formList_ownerRemark: this.createFormList_ownerRemark(),
      ownerRemark_flag: false
    };
  },
  computed: {},
  mounted() {
    this.getResData();
  },
  methods: {
    createFormList_ownerRemark() {
      return [
        {
          type: 'TEXT_AREA',
          label: '车主备注',
          fieldName: 'ownerMemo',
          placeholder: '请输入...'
          // rules: [{ required: true, message: '请输入车主备注', trigger: 'blur' }]
        }
      ];
    },
    formChangeHandle_ownerRemark(val) {
      this.saveData_ownerRemark = val;
      this.ownerRemark_flag = true;
    },
    getData() {
      return this.saveData_ownerRemark;
    },
    async getResData() {
      if (this.type != 'add') {
        let parm = {
          ownerNo: this.resData.OWNER_NO,
          ownerCode: this.resData.OWNER_CODE
        };
        const res = await getOwnerInfoByOwnerNoAndDealerCode(parm);
        this.formList_ownerRemark.find(item => item.fieldName === 'ownerMemo').initialValue = res.data.ownerMemo;
        this.formList_ownerRemark = [...this.formList_ownerRemark];
      }
    }
  }
};
</script>

<style lang="less" scoped></style>
